var clientVer = navigator.userAgent.toLowerCase(); 
var is_firefox = ((clientVer.indexOf("gecko") != -1) && (clientVer.indexOf("firefox") != -1) && (clientVer.indexOf("opera") == -1)); 
function AddText(NewCode) {
	document.getElementById('comment').value+=NewCode
	document.getElementById('comment').focus();
}
function FxGetTxt(open, close)
{var selLength = document.getElementById('comment').textLength;
	var selStart = document.getElementById('comment').selectionStart;
	var selEnd = document.getElementById('comment').selectionEnd;
	if (selEnd == 1 || selEnd == 2)  selEnd = selLength;
	var s1 = (document.getElementById('comment').value).substring(0,selStart);
	var s2 = (document.getElementById('comment').value).substring(selStart, selEnd)
	var s3 = (document.getElementById('comment').value).substring(selEnd, selLength);
	document.getElementById('comment').value = s1 + open + s2 + close + s3;
	return;
}


function italicize() {
if (document.selection && document.selection.type == "Text") {
		var range = document.selection.createRange();
		range.text = "[private]" + range.text + "[/private]";
} else if (is_firefox && document.getElementById('comment').selectionEnd) {
	txt=FxGetTxt ("[private]", "[/private]");
	return;
} else {
	txt=prompt("内容仅为管理员可见","私密内容");
	if (txt!=null) {
		AddTxt="[private]"+txt;
		AddText(AddTxt);
		AddTxt="[/private]";
		AddText(AddTxt);
	}
}
}
